#include <sstream>
#include "arcama.hpp"

#include <QImage>

int main(int argc, char** argv)
{
    if(argc!=3)
    {
        printf("param error\n");
        return 1;
    }

    double scale=1;


    std::istringstream(argv[1])>>scale;

    QImage im(argv[2]);

    if(im.isNull())
    {
        printf("fail to read image: %s\n", argv[2]);
        return 2;
    }

    double centermm[2]={25.4*0.5*im.width()/im.physicalDpiX(),25.4*0.5*im.height()/im.physicalDpiY()};

    //usleep(30000000);

    std::string ipath(argv[2]);

    if(ipath.compare("g33465.png.jpg")==0)
        ArCamA().test(scale, centermm[0], centermm[1], "../share/artoolkit-examples/Data2/markers_full.dat");
    else
        if(ipath.compare("LSCM_logo_c.jpg")==0)
            ArCamA().test(scale, centermm[0], centermm[1], "../share/artoolkit-examples/Data2/markers_c.dat");


    return 0;
}
